import request from '@/utils/request'
// 获取员工简单信息
export const getEmployeeSimple = () =>
  request({
    url: '/sys/user/simple'
  })
// 获取员工信息
export const getEmployee = (params) =>
  request({
    url: '/sys/user',
    params
  })
// 删除员工
export const delEmployee = (id) =>
  request({
    url: '/sys/user/' + id,
    method: 'delete'
  })
// 添加员工
export const addEmployee = (data) =>
  request({
    url: '/sys/user',
    method: 'post',
    data
  })
// excel导入员工数据
export const importEmployee = (data) =>
  request({
    url: '/sys/user/batch',
    method: 'post',
    data
  })

/**
 * @description: 保存员工信息
 * @param {*} data
 * @return {*}
 */
export const saveUserDetailById = (data) =>
  request({
    url: `/sys/user/${data.id}`,
    method: 'put',
    data
  })

/**
 * @description: 为用户分配角色
 * @param {*} data { id:当前用户id, roleIds:选中的角色id组成的数组 }
 * @return {*}
 */
export function assignRoles(data) {
  return request({
    url: '/sys/user/assignRoles',
    data,
    method: 'put'
  })
}
